package com.humngyang.com.hmy.study.springtest;

import com.humngyang.com.hmy.study.springtest.CService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.stereotype.Component;

@Component
public class HmyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        GenericBeanDefinition userservice = (GenericBeanDefinition) beanFactory.getBeanDefinition("c");
        System.out.println(userservice.getBeanClassName());
        userservice.setBeanClass(CService.class);
    }
}
